import java.util.Random;
import java.util.Scanner;

public class suiji {
    public static void main(String[] args) {
       String Line = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
       Random random =new Random();
       String code ="";
       for (int i=0; i<4;i++){
           int index = random .nextInt(Line.length());
           char c = Line.charAt(index);
           code+=c;

       }
       System.out.println("验证码"+code);
       Scanner scanner = new Scanner(System.in);
       System.out.println("请输入上述验证码");
       String input = scanner.nextLine();
       if(code.equalsIgnoreCase(input)){
           System.out.println("通过");
       }else{System.out.println("验证码输入错误");}
        }
//随机验证码基本流程
    }

